#pragma once

namespace BombBox
{
	#define s_pRoomManager (BombBox::RoomManager::getSingletonPtr())

	class GameRoom;
	class SceneConfig;

	class RoomManager : public OSLib::Singleton<RoomManager>
	{
	public:
		RoomManager(void);
		~RoomManager(void);

	public:
		bool play( void );
		bool edit( void );
		bool next( void );
		bool prev( void );
		bool replay( void );
		bool create( void );
		bool publish( void );
		bool save( void );
		bool load( void );

	public:
		void setCurrentBoxType( int nType );
		void setCurrentBombType( int nType );

	public://Edit
		void setBoxType( int nType );
		void doPick( const irr::core::line3d<irr::f32>& ray );
		void addNewItemBox( int nType, const irr::core::vector3df& vPos );
		void addNewItemBomb( int nType, const irr::core::vector3df& vPos );
		int incBombCount( int nBombID );

	public:
		void initialize( int nMapID );
		void shutdown();

	public:
		void setActiveRoom( GameRoom* pRoom );
		void closeRoom( GameRoom* pRoom );

		GameRoom* findRoom( int nRoomID );
		GameRoom* getActiveRoom( void );

	protected:
		SceneConfig* findNext( void );
		SceneConfig* findPrev( void );


	protected:
		irr::core::array<SceneConfig*>		m_vRooms;
		SceneConfig*						m_nCurrentConfig;
		GameRoom*							m_pActiveRoom;

		int									m_nCurrentBoxType;
		int									m_nCurrentBombType;
	};
}
